import { Route, RouteConfig } from "vue-router";
import ShopList from '@/pages/shop/list.vue';
import ShopCategory from '@/pages/shop/category.vue';

import Shopcategory from '@/pages/shop/homeCategory.vue';

import ShopBrdial from '@/pages/shop/bridal.vue';
import Product from '@/pages/shop/product.vue';
import Cart from '@/pages/shop/cart.vue';
import { ROUTE_NAME } from "@/lib/constant";

export const routes: RouteConfig[] = [
    {
        path: '/shop/list',
        name: ROUTE_NAME.SHOP_LIST,
        meta: {
            title: (to: Route) => {
                return to.params.type ? decodeURIComponent(to.params.type) : '商家';
            },
        },
        component: ShopList,
    },
    {
        path: '/shop/product/:shopId',
        name: ROUTE_NAME.SHOP_PRODUCT,
        component: Product,
    },
    {
        path: '/shop/category/:shopId?', // query.type
        name: ROUTE_NAME.SHOP_CATEGORY,
        meta: {
            title: (to: Route) => {
                return to.query.categoryType ? decodeURIComponent(to.query.categoryType as string) : '';
            },
        },
        component: ShopCategory,
    },
// 首页点击tab进入
    {
        path: '/shop/homeCategory', // query.type
        name: ROUTE_NAME.HOME_SHOP_CATEGORY,
        meta: {
            title: (to: Route) => {
                return  '商城'; //to.query.categoryType ? decodeURIComponent(to.query.categoryType as string) : '';
            },
        },
        component: Shopcategory,
    },

    
    {
        path: '/shop/bridal/:shopId',
        name: ROUTE_NAME.SHOP_BRIDAL,
        component: ShopBrdial,
    },
    {
        path: '/shop/cart',
        name: ROUTE_NAME.SHOP_CART,
        meta: {
            title: '购物车',
        },
        component: Cart,
    },
];
